<script type="text/javascript" src="<?php echo JURI::root();?>components/com_nbeventmap/views/nbeventmaplist/tmpl/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="<?php echo JURI::root();?>components/com_nbeventmap/views/nbeventmaplist/tmpl/jquery.jcarousel.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo JURI::root();?>components/com_nbeventmap/views/nbeventmaplist/tmpl/skin.css" />
<script type="text/javascript">
jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel();
    jQuery('#mycarousel').width(845);
});
</script>

<?php
defined('_JEXEC') or die('Restricted access'); 
$dispatcher =& JDispatcher::getInstance(); 
JPluginHelper::importPlugin('content'); 

	switch (substr($params->get('nbeventmap_width'),-1)){
		case '%' :
			$width_carte  = $params->get('nbeventmap_width');
			$width_carte2 = substr($params->get('nbeventmap_width'),0 ,-1);
			$unite_carte  = '%';
			break;
		case 'x' :
			$width_carte  = $params->get('nbeventmap_width');
			$width_carte2 = substr($params->get('nbeventmap_width'),0 ,-2);
			$unite_carte  = 'px';
			break;
		default :
			$width_carte  = $params->get('nbeventmap_width').'px';
			$width_carte2 = $params->get('nbeventmap_width');
			$unite_carte  = 'px';
	}
	if (($params->get('nbeventmap_position_liste')==2)or($params->get('nbeventmap_position_liste')==3)) {
		$width_liste  = $width_carte;
		$width_liste2 = $width_carte2;
		$unite_liste  = $unite_carte;
	}else{
		switch (substr($params->get('nbeventmap_width_list'),-1)){
			case '%' :
				$width_liste  = '200px';
				$width_liste2 = 200;
				$unite_liste  = 'px';
				break;
			case 'x' :
				$width_liste  = $params->get('nbeventmap_width_list');
				$width_liste2 = substr($params->get('nbeventmap_width_list'),0 ,-2);
				$unite_liste  = 'px';
				break;
			default :
				$width_liste  = $params->get('nbeventmap_width_list').'px';
				$width_liste2 = $params->get('nbeventmap_width_list');
				$unite_liste  = 'px';
		}
	}

	$nbre_col	= (int)$params->get('nbeventmap_nombre_col');
	if (!$nbre_col){$nbre_col=1;};
	$width_col 	= ((int)($width_liste2/$nbre_col)).$unite_liste;

?>
<?php
if ($params->get('nbeventmap_filtre')==1) :
	$layout = JRequest::getVar('layout', '', '', 'str');
	$layout_str='';
	if ($layout) {
		$catid = JRequest::getVar('catid', 0, '', 'int');
		$layout_str='&layout='.$layout.'&catid='.$catid;
	};
	$itemid = JRequest::getVar('Itemid', 0, '', 'int');
	$perso = JRequest::getVar('id_perso', 0, '', 'int');
	endif;
	?>

<div>
<table class="blog<?php echo $params->get('pageclass_sfx'); ?>" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" border="1">
    <tr>
		<?php 
		
		if ($params->get('nbeventmap_position_liste')==0) {?>
            <td valign="top">
                <div>   
					<?php
					
					echo $list;?>
				</div>
            </td>
        <?php };?>
        
        </tr>
        <tr>
        <?php 
        	$compte = 0;
			$index_list = 0;
			$decale=false;
		?>
        <td valign="bottom" >
           <div class="nbeventmap_enveloppe_liste">
         <?php echo '<form action="'.JRoute::_('index.php?option=com_nbeventmap&view=nbeventmaplist'.$layout_str.'&id_perso='.$perso.'&Itemid='.$itemid).'" method="post" name="adminForm">';
         ?>
            	<div class="nbeventmap_liste" > 
			 		<ul id="mycarousel"  class="jcarousel-skin-tango" style="cursor: pointer;width:445px;">
        		<?php
     			foreach ($row_dates as $rowDates) {
						$active_id ='activeli_'.$compte;
     				echo '<li class="text_year" id="'.$active_id.'"><span class="sidebar" onclick=\'show_activediv(marker['.$compte.'],'.$compte.') \' >';
					$compte ++;
     				echo $rowDates;
     			}
				?>          
            </div>
		    </form>
            </div>
        </td>
    </tr>
</table>
</div>

<script type="text/javascript" language="javascript">
			var old_liid =''
			function show_activediv(marker,id)
			{
				var curliid = 'activeli_'+id;
				if(old_liid=='')
				{
					document.getElementById(curliid).className =document.getElementById(curliid).className + ' year_active';
					old_liid = curliid;
				}
				else
				{
					document.getElementById(old_liid).className =document.getElementById(curliid).className;
					document.getElementById(curliid).className =document.getElementById(curliid).className + ' year_active';
					old_liid = curliid;
				}
				GEvent.trigger(marker,"mouseover")
			}
</script>
